<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE html
        PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

<h:body>
    <h:form id="expenseMaterialForm">
        <p:growl id="growl" showDetail="true" life="3000"/>
        <h:panelGrid columns="2" cellpadding="10" cellspacing="10">
            <h:outputLabel for="material_name" value="Наименование: "/>
            <p:autoComplete id="material_name" queryDelay="500"
                            value="#{materialsBean.equipment.name}" effect="fade"
                            completeMethod="#{materialsBean.getCompleteMaterial}"/>
            <h:outputLabel for="material_object" value="Объект: "/>
            <p:selectOneMenu id="material_object" value="#{materialsBean.equipmentsProjects.objects.name}" effect="fold" >
                <f:selectItem itemLabel="Выберите объект " itemValue="" />
                <f:selectItems value="#{projectBean.projects}" />
            </p:selectOneMenu>

            <h:outputLabel for="material_quantity" value="Количество: "/>
            <p:inputText id="material_quantity" value="#{materialsBean.equipmentsProjects.id.total}" required="true"/>

            <h:outputLabel for="material_coming_date" value="Дата: "/>
            <p:calendar  value="#{materialsBean.equipmentsProjects.id.deliveryDate}" id="material_coming_date"
                         showButtonPanel="true"/>
            <f:facet name="footer">
                <p:commandButton value="Добавить"  actionListener="#{materialsBean.saveExpense()}"
                                 oncomplete="handleExpenseMaterialRequest(xhr, status, args)" />
                <p:commandButton value="Отмена"  actionListener="#{materialsBean.closeExpense}"
                                 immediate="true"/>
            </f:facet>
        </h:panelGrid>

    </h:form>
</h:body>

</html>